
DUMP=DUMP
#TOP=tb_pe_array
TOP=tb_axi_xbar
MODE=SIM
DEBUG_COMP_OPTS += -assert svaext
LINT_COMP_OPTS  += +lint=all,noVCDE,noNS
#TOP=pe_array
TB_VLOG_F  = -f ./all.vc
#VLOG_COMP_OPTS += -full64   -cpp g++-4.4 -cc gcc-4.4   -lca -kdb  -debug_pp   +vcd+vcdpluson  
VLOG_COMP_OPTS += -full64   -LDFLAGS -Wl,--no-as-needed -lca -kdb  -debug_pp   +vcd+vcdpluson  
VLOG_COMP_OPTS += -sverilog -v2k_generate
VLOG_COMP_OPTS += -timescale=1ns/1ps
VLOG_COMP_OPTS += +define+VCS+${DUMP}+${MODE}
VLOG_COMP_OPTS += $(TB_VLOG_F)
VLOG_COMP_OPTS += $(DEBUG_COMP_OPTS)
VLOG_COMP_OPTS += $(LINT_COMP_OPTS)
VLOG_COMP_OPTS += $(UVM_COMP_OPTS)
VLOG_COMP_OPTS += $(RAL_COMP_OPTS)
VLOG_COMP_OPTS += +incdir+./+incdir+../

TB_TOP_MODEL_NAME  = $(TOP)
LICENSE_OPTS    += +error+1000
LINT_COMP_OPTS  += +lint=all,noVCDE,noNS
DEBUG_COMP_OPTS += 
#DEBUG_ELAB_OPTS += -debug_access+pp+drivers
DEBUG_ELAB_OPTS += -debug_pp   +vcd+vcdpluson  

ELAB_OPTS += -full64
ELAB_OPTS += $(LICENSE_OPTS)
ELAB_OPTS += $(DEBUG_ELAB_OPTS)
ELAB_OPTS += $(UVM_ELAB_OPTS)
ELAB_OPTS += $(COV_ELAB_OPTS)
ELAB_OPTS += $(OPT_CONFIG_F)
ELAB_OPTS += $(XILINX_CORE_ELAB_OPTS)
ELAB_OPTS += +lint=TFIPC-L

RUN_OPTS +=	$(LICENSE_OPTS)
RUN_OPTS +=	$(DEBUG_RUN_OPTS)
RUN_OPTS += $(RAL_RUN_OPTS)
RUN_OPTS += $(COV_RUN_OPTS)
RUN_OPTS += +UVM_TESTNAME=base_test
RUN_OPTS +=	+vpdfileswitchsize+3000
RUN_OPTS +=	+ntb_random_seed=$(SEED)
RUN_OPTS +=	+notimingcheck

#VERDI_PATH = /usr/synopsys/verdi/Verdi_O-2018.09-SP2
VERDI_PATH = /usr/synopsys/verdi/Verdi_O-2018.09-SP2
#VERDI_PATH = /usr/synopsys/Verdi3_L-2016.06-1


CFLAG	   = -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -g
#C_HOME = ../test_pe
C_HOME = ../c



default:
	##vcs -static_debug -f tb.vc -sverilog -full64 -assert svaext
	vcs  ${VLOG_COMP_OPTS}   -top $(TB_TOP_MODEL_NAME)  -P  $(VERDI_PATH)/share/PLI/VCS/LINUX64/novas.tab   $(VERDI_PATH)/share/PLI/VCS/LINUX64/pli.a   -l vcs_comp.log
	./simv $(RUN_OPTS)   -l run.log

com:
	vcs  ${VLOG_COMP_OPTS}   -top $(TB_TOP_MODEL_NAME)  -P  $(VERDI_PATH)/share/PLI/VCS/LINUX64/novas.tab   $(VERDI_PATH)/share/PLI/VCS/LINUX64/pli.a   -l vcs_comp.log

sim:
	./simv $(RUN_OPTS)   -l run.log
	


grep:
	grep CASE  run*.log   | tee  result
	grep FAIL  result     | tee  fail 


verdi:
	verdi -sv -f all.vc &



emacs:
	emacs   --batch   ini_mem.v             -f verilog-auto     -f save-buffer 	
	emacs   --batch   tx_sys.v             -f verilog-auto     -f save-buffer 	
	emacs   --batch   forcelist.v             -f verilog-auto     -f save-buffer 	
	emacs   --batch   tb.sv             -f verilog-auto     -f save-buffer 	

clean:
	rm -rf novas*  verdiLog  *.fsdb*  *.vpd   ucli.key  vc_hdrs.h   csrc mac*  simv*  
	
